import { ConfigType, PageType } from "@/type/type";
import { useState } from "react"


let config:ConfigType = {
    deviceId:'',
    border:'1px',
    color:"red",
    page:PageType.SETTING,
    isRadius:false
}
export default function (){

    const setConfig = (options:ConfigType)=>{
        localStorage.setItem("config",JSON.stringify(options));
        config = options;
    }
    const cache = localStorage.getItem("config") as string;
    const device = cache?JSON.parse(cache) as ConfigType:config;
    config = device
    return {
        config,
        setConfig
    }
}

